﻿<!DOCTYPE HTML>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>static/h-ui.admin/css/style.css" />
</head>
<body>
	<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>系统管理 <span class="c-gray en">&gt;</span> 角色权限管理 <a id="btn-refresh" onclick="_refresh('AppLoginLogList.action');" class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
	<div class="page-container">
		<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="member_add('添加角色','<%=basePath%>jsp/menu/addRole.action','600','400')" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加角色</a> </span> </div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort">
				<thead>
					<tr class="text-c">
						<th width="25"><input type="checkbox" name="" value=""></th>
						<th>角色名称</th>
						<th>是否启用</th>
						<th>备注</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${roleList}" var="r">
						<tr class="text-c">
							<td><input type="checkbox" value="${r.rid}"></td>
							<td>${r.rname}</td>
							<td>
								<c:if test="${r.enabled == 1}">启用</c:if>
								<c:if test="${r.enabled == 0}">未启用</c:if>
							</td>
							<td>${r.remark}</td>
							<td>
								<a name="${r.rid}" style="text-decoration:none" class="ml-5"  href="javascript:;" title="编辑角色拥有菜单"><i class="Hui-iconfont">&#xe6df;</i></a>
								<a name="${r.rid}" style="text-decoration:none" class="ml-7"  href="javascript:;" title="删除角色"><i class="Hui-iconfont">&#xe6e2;</i></a>
							</td>
						</tr>
						
					</c:forEach>
				</tbody>
				<tbody>
				</tbody>
			</table>
		</div>
	</div>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/layer/2.4/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="<%=basePath%>static/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>static/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
});

function member_add(title,url,w,h){	
	layer_show(title,url,w,h);
}

$(function() {
	$("table").on("click" ,".ml-5", function(){
		article_edit('角色菜单编辑','<%=basePath%>jsp/menu/roleMenu.action?rid='+this.getAttribute("name"),700,450 )
	});
	
	$("table").on("click" ,".ml-7", function(){
		article_del('删除角色','<%=basePath%>jsp/menu/roleDelete.action?rid='+this.getAttribute("name") )
	});
})

function article_edit(title,url,id,w,h){
	layer_show(title,url,id,w,h);
}

function article_del(title,url){
layer.confirm('确认删除吗？',function(index){
	$.ajax({
		type: 'POST',
		url: url,
		dataType: 'text',
		success: function(data){
			if (data == "success") {
				layer.msg('已删除!',{icon:1,time:1000});
				location.replace(location.href);
			} else {
				layer.msg('删除失败!',{icon:1,time:1000});
				location.replace(location.href);
			}
		},
		error:function(data) {
			console.log(data.msg);
		},
	});	
});
}
</script> 
</body>
</html>